import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/index.vue'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: 'home'
  },
  {
    path: '/home',
    name: 'Home',
    component: Home
  },
  {
    path: '/home/newgoods/:id', ///   /home/newgoods/1
    name: 'newgoods',
    component: () => import('../views/home/newGoods')
  },
  {
    path: '/home/search',
    name: 'Search',
    component: () => import('../views/home/search/index')
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('../views/About.vue')
  },
  {
    path: '/cart',
    name: 'Cart',
    component: () => import('../views/cart/index.vue')
  },
  {
    path: '/category',
    name: 'Category',
    component: () => import('../views/category/index.vue')
  },
  {
    path: '/mine',
    name: 'Mine',
    component: () => import('../views/mine/index.vue')
  },
  {
    path: '/topic',
    name: 'Topic',
    component: () => import('../views/topic/index.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
